Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Aug 11, 2025

Fixes microsoft#25369

Problem

The Python extension's "Report Issue" command was displaying duplicate content in the VSCode issue reporter. This occurred because both the static template (report_issue_template.md) and the formatted diagnostic data (report_issue_user_data_template.md) were being passed to the VSCode issue reporter API simultaneously:

await this.commandManager.executeCommand('workbench.action.openIssueReporter', {
    extensionId: 'ms-python.python',
    issueBody: template,                // Static template with placeholders
    data: userTemplate.format(         // Formatted diagnostic data
        pythonVersion,
        virtualEnvKind,
        languageServer,
        // ... other diagnostic info
    ),
});

This resulted in users seeing both the generic issue template and the diagnostic information, leading to a confusing and cluttered issue reporting experience.

Solution

The fix preserves the structured issue template while eliminating duplication by merging the formatted diagnostic data directly into the template. The diagnostic data now replaces the XXX placeholder in the template's diagnostic section:

const formattedDiagnosticData = userTemplate.format(
    pythonVersion,
    virtualEnvKind,
    languageServer,
    hasMultipleFoldersText,
    userSettings,
    installedExtensions.join('\n'),
);

// Replace the XXX placeholder in the diagnostic data section with the formatted diagnostic data
const issueBodyWithDiagnostics = template.replace('XXX', formattedDiagnosticData);

await this.commandManager.executeCommand('workbench.action.openIssueReporter', {
    extensionId: 'ms-python.python',
    issueBody: issueBodyWithDiagnostics,
});

Changes

  • reportIssueCommand.ts: Modified to merge formatted diagnostic data into the template by replacing the XXX placeholder, then pass only the combined result as issueBody
  • reportIssueCommand.unit.test.ts: Updated test expectations to verify the merged template approach

This approach maintains the user guidance from the static template while ensuring diagnostic information is properly embedded without duplication.

Benefits

  • Users still see the structured issue template with guidance sections
  • Diagnostic data is properly embedded where expected
  • No duplicate content between template and diagnostic data
  • Preserves all essential diagnostic information for effective issue reporting

Testing

All existing unit tests pass, confirming that the diagnostic data formatting and issue reporter integration continue to work correctly with the new merged approach.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] Fixing Duplicate Content in Python Report Issue Template Fix duplicate content in Python Report Issue template Aug 11, 2025
@Copilot Copilot AI requested a review from eleanorjboyd August 11, 2025 00:32
Copilot finished work on behalf of eleanorjboyd August 11, 2025 00:32
@eleanorjboyd
Copy link
Owner

@copilot can you update this to instead keep the template but remove the duplication that comes from the formatted diagnostic data

Copy link
Author

Copilot AI commented Aug 11, 2025

@copilot can you update this to instead keep the template but remove the duplication that comes from the formatted diagnostic data

I've updated the approach to keep the template as requested. Instead of removing the static template, the solution now merges the formatted diagnostic data into the template by replacing the XXX placeholder in the diagnostic data section. This eliminates duplication while preserving the user guidance structure.

The key changes:

  • Format the diagnostic data first
  • Replace XXX placeholder in template with the formatted diagnostic data
  • Pass only the combined result as issueBody (no separate data field)

All unit tests pass, confirming the functionality works correctly. Commit: 4736b76

@Copilot Copilot AI changed the title Fix duplicate content in Python Report Issue template Fix duplicate content in Python Report Issue template by merging diagnostic data Aug 11, 2025
Copilot finished work on behalf of eleanorjboyd August 11, 2025 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: Report Issue template repeats twice

2 participants